package com.zlx.store.domain.doc;

import com.zlx.store.domain.entity.Goods;
import com.zlx.store.domain.entity.GoodsCategory;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import com.zlx.store.domain.entity.Store;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Document(indexName="goods_doc",createIndex=true)
public class GoodsDoc {
    @Id
    private String goodsId;
    /**
     * 商品名字
     */
    private String goodsName;
    /**
     * 商品编号
     */
    private String goodsSPU;

    /**
     * 商品图片的地址
     */
    private String goodsPic;
    /**
     * 商品描述
     */
    private String goodsDescription;

    /**
     * 商品价格
     */
    private Double goodsPrice;
    /**
     * 商品是否新人专享.1表示是
     */
    private Integer goodsForNewcomer;
    /**
     * 商品销量
     */
    private Integer goodsSales;
    /**
     * 商品折扣情况,
     */
    private Double goodsDiscount;
    /**
     * 商品种类
     */
    private String goodsCategory;
    /**
     * 商品门店
     */
    private String goodsStore;
    public GoodsDoc build(Goods goods, String goodsCategory,String store){
        this.goodsId=String.valueOf(goods.getGoodsId());
        this.goodsName=goods.getGoodsName();
        this.goodsSPU=goods.getGoodsSPU();
        this.goodsPic=goods.getGoodsPic();
        this.goodsDescription=goods.getGoodsDescription();
        this.goodsPrice=goods.getGoodsPrice();
        this.goodsForNewcomer=goods.getGoodsForNewcomer();
        this.goodsSales=goods.getGoodsSales();
        this.goodsDiscount=goods.getGoodsDiscount();
        this.goodsCategory=goodsCategory;
        this.goodsStore=store;
        return this;
    }
}
